import { QINIU_CLIENT, QINIU_MODULE_OPTIONS } from './qiniu.constants';
import { QiniuModuleAsyncOptions } from './qiniu.interface';

export interface QiniuOptions {
  accessKey: string;
  secretKey: string;
  bucket: string;
  qiniuHost: string;
}

export const createQiniuOptions = () => ({
  provide: QINIU_CLIENT,
  useFactory: (options: any) => {
    console.log('七牛云配置信息', options);
    return { ...options };
  },
  inject: [QINIU_MODULE_OPTIONS],
});

export const createAsyncQiniuOptions = (options: QiniuModuleAsyncOptions) => ({
  provide: QINIU_MODULE_OPTIONS,
  useFactory: options.useFactory,
  inject: options.inject,
});
